load("//tools/lint:lint.bzl", "add_lint_tests")
load(
    "//tools/skylark:drake_cc.bzl",
    "drake_cc_binary",
    "drake_cc_googletest",
    "drake_cc_library",
)

package(default_visibility = ["//visibility:private"])

drake_cc_library(
    name = "allegro_common",
    srcs = ["allegro_common.cc"],
    hdrs = ["allegro_common.h"],
    visibility = ["//examples/allegro_hand/joint_control:__pkg__"],
    deps = [
        "//lcmtypes:lcmtypes_drake_cc",
        "//multibody/plant",
    ],
)

drake_cc_library(
    name = "allegro_lcm",
    srcs = ["allegro_lcm.cc"],
    hdrs = ["allegro_lcm.h"],
    visibility = ["//examples/allegro_hand/joint_control:__pkg__"],
    deps = [
        ":allegro_common",
        "//lcmtypes:lcmtypes_drake_cc",
        "//systems/framework:leaf_system",
    ],
)

drake_cc_binary(
    name = "run_allegro_constant_load_demo",
    srcs = ["run_allegro_constant_load_demo.cc"],
    data = [
        "@drake_models//:allegro_hand_description",
    ],
    deps = [
        "//common:add_text_logging_gflags",
        "//lcm",
        "//multibody/parsing",
        "//multibody/plant",
        "//systems/analysis:simulator",
        "//systems/primitives:constant_vector_source",
        "//visualization:visualization_config_functions",
        "@gflags",
    ],
)

# === test/ ===

drake_cc_googletest(
    name = "allegro_lcm_test",
    deps = [
        ":allegro_common",
        ":allegro_lcm",
        "//common/test_utilities:eigen_matrix_compare",
        "//systems/framework",
    ],
)

drake_cc_googletest(
    name = "parse_test",
    data = [
        "@drake_models//:allegro_hand_description",
    ],
    deps = [
        "//common:find_resource",
        "//multibody/parsing",
        "//multibody/plant",
    ],
)

add_lint_tests()
